home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / games / nhak_src.zip / POTION.C < prev    next >
C/C++ Source or Header  |  1993-03-16  |  32KB  |  1,316 lines

  1. /*    SCCS Id: @(#)potion.c    3.0    88/11/11
  2. /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
  3. /* NetHack may be freely redistributed.  See license for details. */
  4.  
  5. #include "hack.h"
  6.  
  7. #ifdef OVLB
  8. static void NDECL(ghost_from_bottle);
  9. static boolean FDECL(neutralizes, (struct obj *,struct obj *));
  10.  
  11. static int NEARDATA nothing, NEARDATA unkn;
  12. #endif /* OVLB */
  13.  
  14. #ifdef WORM
  15.  
  16. extern boolean notonhead;
  17.  
  18. #ifdef OVLB
  19.  
  20. boolean notonhead = FALSE;
  21.  
  22. #endif /* OVLB */
  23.  
  24. #endif
  25.  
  26. #ifdef OVLB
  27.  
  28. static const char NEARDATA beverages[] = { POTION_SYM, 0 };
  29.  
  30. void
  31. make_confused(xtime,talk)
  32. long xtime;
  33. boolean talk;
  34. {
  35.     long old = HConfusion;
  36.  
  37.     if (!xtime && old) {
  38.         if (talk) {
  39.             if (Hallucination) You("feel less trippy now.");
  40.             else           You("feel less confused now.");
  41.         }
  42.         flags.botl = 1;
  43.     }
  44.     if (xtime && !old)
  45.         flags.botl = 1;
  46.     HConfusion = xtime;
  47. }
  48.  
  49. void
  50. make_stunned(xtime,talk)
  51. long xtime;
  52. boolean talk;
  53. {
  54.     long old = HStun;
  55.  
  56.     if (!xtime && old) {
  57.         if (talk) {
  58.             if (Hallucination) You("feel less wobbly now.");
  59.             else           You("feel a bit steadier now.");
  60.         }
  61.         flags.botl = 1;
  62.     }
  63.     if (xtime && !old) {
  64.         if (talk)
  65.             You("stagger...");
  66.         flags.botl = 1;
  67.     }
  68.     HStun = xtime;
  69. }
  70.  
  71. void
  72. make_sick(xtime, talk)
  73. long xtime;
  74. boolean talk;
  75. {
  76.     long old = Sick;
  77.  
  78. #ifdef POLYSELF
  79.     if (xtime && u.usym == S_FUNGUS) return;
  80. #endif
  81.     if (!xtime && old) {
  82.         if (talk) pline("What a relief!");
  83.         flags.botl = 1;
  84.     }
  85.     if (!old && xtime) {
  86.         You("feel deathly sick.");
  87.         flags.botl = 1;
  88.     }
  89.     Sick = xtime;
  90. }
  91.  
  92. void
  93. make_vomiting(xtime, talk)
  94. long xtime;
  95. boolean talk;
  96. {
  97.     long old = Vomiting;
  98.  
  99.     if(!xtime && old)
  100.         if(talk) You("feel much less nauseous now.");
  101.  
  102.     Vomiting = xtime;
  103. }
  104.  
  105.  
  106. void
  107. make_blinded(xtime, talk)
  108. long xtime;
  109. boolean talk;
  110. {
  111.     long old = Blinded;
  112.  
  113.     if (!xtime && old && !Blindfolded) {
  114.         if (talk) {
  115.             if (Hallucination) pline("Oh, like, wow!  What a rush.");
  116.             else           You("can see again.");
  117.         }
  118.         flags.botl = 1;
  119.     }
  120.     if (xtime && !old && !Blindfolded) {
  121.         if (talk) {
  122.             if (Hallucination)
  123.                 pline("Bummer!  Everything is dark!  Help!");
  124.             else
  125.                 pline("A cloud of darkness falls upon you.");
  126.         }
  127.         seeoff(0);
  128.         flags.botl = 1;
  129.     }
  130.     Blinded = xtime;
  131.     if (!Blind)
  132.         setsee();
  133. }
  134.  
  135. void
  136. make_hallucinated(xtime, talk)
  137. long xtime;
  138. boolean talk;
  139. {
  140.     long old = Hallucination;
  141.     register struct monst *mtmp;
  142.  
  143.     if (!xtime && old ) {
  144.         if (!Blind && talk) pline("Everything looks SO boring now.");
  145.         for (mtmp=fmon; mtmp; mtmp=mtmp->nmon)
  146.           if (showmon(mtmp))
  147.             atl(mtmp->mx, mtmp->my, (!mtmp->m_ap_type ||
  148.                          Protection_from_shape_changers)
  149.             ? mtmp->data->mlet : (char) mimic_appearance(mtmp));
  150.         flags.botl = 1;
  151.     }
  152.     if (xtime && !old ) {
  153.         if (!Blind && talk) pline("Oh wow!  Everything looks so cosmic!");
  154.         flags.botl = 1;
  155.     }
  156.     Hallucination = xtime;
  157.     setsee();
  158. }
  159.  
  160. static void
  161. ghost_from_bottle()
  162. {
  163.     struct monst *mtmp = makemon(&mons[PM_GHOST], u.ux, u.uy);
  164.  
  165.     if (!mtmp) {
  166.         pline("This bottle turns out to be empty.");
  167.         return;
  168.     }
  169.     if (Blind) {
  170.         pline("As you open the bottle, something emerges.");
  171.         return;
  172.     }
  173.     pline("As you open the bottle, an enormous %s emerges!",
  174.         Hallucination ? rndmonnam() : "ghost");
  175.     if(flags.verbose)
  176.         You("are frightened to death, and unable to move.");
  177.     nomul(-3);
  178.     nomovemsg = "You regain your composure.";
  179. }
  180.  
  181. int
  182. dodrink() {
  183.     register struct obj *otmp;
  184.  
  185.     if (Strangled) {
  186.         pline("If you can't breathe air, how can you drink liquid?");
  187.         return 0;
  188.     }
  189. #ifdef FOUNTAINS
  190.     /* Is there a fountain to drink from here? */
  191.         if (IS_FOUNTAIN(levl[u.ux][u.uy].typ)) {
  192.         pline("Drink from the fountain? ");
  193.         if(yn() == 'y') {
  194.             (void) drinkfountain();
  195.             return 1;
  196.         }
  197.     }
  198. #endif
  199. #ifdef SINKS
  200.     /* Or a kitchen sink? */
  201.     if (IS_SINK(levl[u.ux][u.uy].typ)) {
  202.         pline("Drink from the sink? ");
  203.         if (yn() == 'y') {
  204.             (void) drinksink();
  205.             return 1;
  206.         }
  207.     }
  208. #endif
  209.  
  210.     otmp = getobj(beverages, "drink");
  211.     if(!otmp) return(0);
  212. #ifndef NO_SIGNAL
  213.     otmp->in_use = TRUE;        /* you've opened the stopper */
  214. #endif
  215.     if(objects[otmp->otyp].oc_descr && !strcmp(objects[otmp->otyp].oc_descr, "smoky") && !rn2(13)) {
  216.         ghost_from_bottle();
  217.         useup(otmp);
  218.         return(1);
  219.     }
  220.     if(objects[otmp->otyp].oc_descr && !strcmp(objects[otmp->otyp].oc_descr, "glowing") && !rn2(13)) {
  221.         djinni_from_bottle(otmp);
  222.         useup(otmp);
  223.         return(1);
  224.     }
  225.     return dopotion(otmp);
  226. }
  227.  
  228. int
  229. dopotion(otmp)
  230. register struct obj *otmp;
  231. {
  232.     int retval;
  233.  
  234.     nothing = unkn = 0;
  235.     if((retval = peffects(otmp)) >= 0) return(retval);
  236.  
  237.     if(nothing) {
  238.         unkn++;
  239.         You("have a %s feeling for a moment, then it passes.",
  240.           Hallucination ? "normal" : "peculiar");
  241.     }
  242.     if(otmp->dknown && !objects[otmp->otyp].oc_name_known) {
  243.         if(!unkn) {
  244.             makeknown(otmp->otyp);
  245.             more_experienced(0,10);
  246.         } else if(!objects[otmp->otyp].oc_uname)
  247.             docall(otmp);
  248.     }
  249.     useup(otmp);
  250.     return(1);
  251. }
  252.  
  253. int
  254. peffects(otmp)
  255.     register struct obj    *otmp;
  256. {
  257.     register int i, ii, isdone;
  258.  
  259.     switch(otmp->otyp){
  260.     case POT_RESTORE_ABILITY:
  261. #ifdef SPELLS
  262.     case SPE_RESTORE_ABILITY:
  263. #endif
  264.         unkn++;
  265.         if(otmp->cursed) {
  266.             pline("Ulch!  This makes you feel mediocre!");
  267.             break;
  268.         } else {
  269.             pline("Wow!  This makes you feel %s!",
  270.               (otmp->blessed) ? "great" : "good");
  271.             i = rn2(A_MAX);        /* start at a random point */
  272.             for(isdone = ii = 0; !isdone && ii < A_MAX; ii++) {
  273.             if(ABASE(i) < AMAX(i)) {
  274.                 ABASE(i) = AMAX(i);
  275.                 /* only first found if not blessed */
  276.                 isdone = !(otmp->blessed);
  277.                 flags.botl = 1;
  278.             }
  279.             if(++i >= A_MAX) i = 0;
  280.             }
  281.             if((ABASE(A_STR) == AMAX(A_STR)) && (u.uhs >= 3))
  282.             losestr(1);        /* kludge - mrs */
  283.         }
  284.         break;
  285.     case POT_HALLUCINATION:
  286.         if (Hallucination) nothing++;
  287.         make_hallucinated(Hallucination +
  288.                   rn1(200, 600 - 300*bcsign(otmp)), TRUE);
  289.         break;
  290.     case POT_WATER:
  291.         if(!otmp->blessed && !otmp->cursed) {
  292.             pline("This tastes like %swater.",
  293.                   otmp->spe == -1 ? "impure " : "");
  294.             lesshungry(rnd(otmp->spe == -1 ? 3 : 10));
  295.             break;
  296.         }
  297.         unkn++;
  298. #ifdef POLYSELF
  299.         if(is_undead(uasmon) || is_demon(uasmon) || 
  300.                 u.ualigntyp == U_CHAOTIC) {
  301.             if(otmp->blessed) {
  302.             pline("This burns like acid!");
  303.             if (u.ulycn != -1) {
  304.                 Your("affinity to %s disappears!",
  305.                      makeplural(mons[u.ulycn].mname));
  306.                 if(uasmon == &mons[u.ulycn] && !Polymorph_control)
  307.                     rehumanize();
  308.                 u.ulycn = -1;
  309.             }
  310.             losehp(d(2,6), "potion of holy water", KILLED_BY_AN);
  311.             } else if(otmp->cursed) {
  312.             You("feel quite proud of yourself.");
  313.             healup(d(2,6),0,0,0);
  314.             }
  315.         } else
  316. #endif
  317.             if(otmp->blessed) {
  318.             You("feel full of awe.");
  319.             make_sick(0L,TRUE);
  320. #ifdef POLYSELF
  321.             if (u.ulycn != -1) {
  322.                 You("feel purified.");
  323.                 if(uasmon == &mons[u.ulycn] && !Polymorph_control)
  324.                     rehumanize();
  325.                 u.ulycn = -1;
  326.             }
  327. #endif
  328.             /* make_confused(0L,TRUE); */
  329.             } else {
  330.             if(u.ualigntyp == U_LAWFUL) {
  331.                 pline("This burns like acid!");
  332.                 losehp(d(2,6), "potion of unholy water",
  333.                 KILLED_BY_AN);
  334.             } else
  335.                 You("feel full of dread.");
  336.             }
  337.         break;
  338.     case POT_BOOZE:
  339.         unkn++;
  340.         pline("Ooph!  This tastes like %s!",
  341.               Hallucination ? "furniture polish" : "liquid fire");
  342.         if (!otmp->blessed) make_confused(HConfusion + d(3,8),FALSE);
  343.         /* the whiskey makes us feel better */
  344.         if(u.uhp < u.uhpmax) losehp(-1, "", 0); /* can't kill you */
  345.         lesshungry(10 * (2 + bcsign(otmp)));
  346.         if(otmp->cursed) {
  347.             You("pass out.");
  348.             multi = -rnd(15);
  349.             nomovemsg = "You awake with a headache.";
  350.         }
  351.         break;
  352.     case POT_ENLIGHTENMENT:
  353.         if(otmp->cursed) {
  354.             unkn++;
  355.             You("have an uneasy feeling...");
  356.         } else {
  357.             if (otmp->blessed) {
  358.                 adjattrib(A_INT, 1, FALSE);
  359.                 adjattrib(A_WIS, 1, FALSE);
  360.             }
  361.             You("feel self-knowledgeable...");
  362.             more();
  363.             enlightenment();
  364.             pline("The feeling subsides.");
  365.         }
  366.         break;
  367.     case POT_INVISIBILITY:
  368. #ifdef SPELLS
  369.     case SPE_INVISIBILITY:
  370. #endif
  371.         if(Invisible || See_invisible) nothing++;
  372.         else {
  373.              newsym(u.ux,u.uy);
  374.              if(!Blind)
  375.                pline(Hallucination ?
  376.              "Far out, man!  You can see right through yourself!" :
  377.              "Gee!  All of a sudden, you can't see yourself.");
  378.              else
  379.                You("feel rather airy."), unkn++;
  380.         }
  381.         if (otmp->blessed && !(HInvis & INTRINSIC)) {
  382.             nothing = 0;
  383. #ifndef MACOS
  384.             pline("Do you want the invisibility to be permanent? ");
  385.             if (yn()=='n') HInvis += rn1(15,31);
  386.             else HInvis |= INTRINSIC;
  387. #else
  388.             if (UseMacAlertText(128,
  389.                 "Do you want the invisibility to be permanent ?")
  390.                 == 2) HInvis += rn1(15,31);
  391.             else HInvis |= INTRINSIC;
  392. #endif
  393.         } else HInvis += rn1(15,31);
  394.         if(otmp->cursed) {
  395.             pline("For some reason, you feel your presence is known.");
  396.             aggravate();
  397.         }
  398.         break;
  399.     case POT_SEE_INVISIBLE:
  400.     case POT_FRUIT_JUICE:
  401.         unkn++;
  402.         if(otmp->cursed)
  403.             pline("Yecch!  This tastes %s.",
  404.               Hallucination ? "overripe" : "rotten"
  405.              );
  406.         else pline (Hallucination ?
  407. #ifdef TUTTI_FRUTTI
  408.            "This tastes like 10%% real %s juice all-natural beverage." :
  409.            "This tastes like %s juice.", pl_fruit);
  410. #else
  411.            "This tastes like 10%% real fruit juice all-natural beverage." :
  412.            "This tastes like fruit juice.");
  413. #endif
  414.         if (otmp->otyp == POT_FRUIT_JUICE) {
  415.             lesshungry(10 * (2 + bcsign(otmp)));
  416.             break;
  417.         }
  418.         if (!otmp->cursed) {
  419.             /* Tell them they can see again immediately, which
  420.              * will help them identify the potion...
  421.              */
  422.             make_blinded(0L,TRUE);
  423.         }
  424.         if (otmp->blessed)
  425.             HSee_invisible |= INTRINSIC;
  426.         else
  427.             HSee_invisible += rn1(100,750);
  428.         break;
  429.     case POT_PARALYSIS:
  430.         if(Levitation)
  431.             You("are motionlessly suspended.");
  432.         else
  433.             Your("%s are frozen to the floor!",
  434.                 makeplural(body_part(FOOT)));
  435.         nomul(-(rn1(10, 25 - 12*bcsign(otmp))));
  436.         break;
  437.     case POT_MONSTER_DETECTION:
  438. #ifdef SPELLS
  439.     case SPE_DETECT_MONSTERS:
  440. #endif
  441.         if (monster_detect(otmp))
  442.             return(1);        /* nothing detected */
  443.         break;
  444.     case POT_OBJECT_DETECTION:
  445. #ifdef SPELLS
  446.     case SPE_DETECT_TREASURE:
  447. #endif
  448.         if (object_detect(otmp))
  449.             return(1);        /* nothing detected */
  450.         break;
  451.     case POT_SICKNESS:
  452.         pline("Yecch!  This stuff tastes like poison.");
  453.         if (otmp->blessed) {
  454. #ifdef TUTTI_FRUTTI
  455.         pline("(But in fact it was mildly stale %s juice.)", pl_fruit);
  456. #else
  457.         pline("(But in fact it was mildly stale orange juice.)");
  458. #endif
  459.             if (pl_character[0] != 'H')
  460.                 losehp(1, "mildly contaminated potion",
  461.                     KILLED_BY_AN);
  462.         } else {
  463.             if(Poison_resistance)
  464. #ifdef TUTTI_FRUTTI
  465.     pline("(But in fact it was biologically contaminated %s juice.)",pl_fruit);
  466. #else
  467.     pline("(But in fact it was biologically contaminated orange juice.)");
  468. #endif
  469.             if (pl_character[0] == 'H')
  470.             pline("Fortunately, you have been immunized.");
  471.             else {
  472.             int typ = rn2(A_MAX);
  473.             poisontell(typ);
  474.             adjattrib(typ,Poison_resistance ? -1 : -rn1(4,3), TRUE);
  475.             if(!Poison_resistance)
  476.                 losehp(rnd(10)+5*!!(otmp->cursed),
  477.                        "contaminated potion", KILLED_BY_AN);
  478.             }
  479.         }
  480.         if(Hallucination) {
  481.             You("are shocked back to your senses!");
  482.             make_hallucinated(0L,FALSE);
  483.         }
  484.         break;
  485.     case POT_CONFUSION:
  486.         if(!Confusion)
  487.             if (Hallucination) {
  488.             pline("What a trippy feeling!");
  489.             unkn++;
  490.             } else
  491.             pline("Huh, What?  Where am I?");
  492.         else    nothing++;
  493.         make_confused(HConfusion + rn1(7,16-8*bcsign(otmp)),FALSE);
  494.         break;
  495.     case POT_GAIN_ABILITY:
  496.         if(otmp->cursed) {
  497.             pline("Ulch!  That potion tasted foul!");
  498.             unkn++;
  499.         } else {
  500.             i = rn2(A_MAX);        /* start at a random point */
  501.             for(isdone = ii = 0; !isdone && ii < A_MAX; ii++) {
  502.             adjattrib(i, 1, FALSE);
  503.             /* only first found if not blessed */
  504.             isdone = !(otmp->blessed);
  505.             flags.botl = 1;
  506.             if(++i >= A_MAX) i = 0;
  507.             }
  508.         }
  509.         break;
  510.     case POT_SPEED:
  511.         if(Wounded_legs && !otmp->cursed) {
  512.             heal_legs();
  513.             unkn++;
  514.             break;
  515.         }        /* and fall through */
  516. #ifdef SPELLS
  517.     case SPE_HASTE_SELF:
  518. #endif
  519.         if(!(Fast & TIMEOUT))
  520.             You("are suddenly moving much faster.");
  521.         else {
  522.             Your("%s get new energy.",
  523.                 makeplural(body_part(LEG)));
  524.             unkn++;
  525.         }
  526.         Fast += rn1(10,100+60*bcsign(otmp));
  527.         break;
  528.     case POT_BLINDNESS:
  529.         if(Blind) nothing++;
  530.         make_blinded(Blinded + rn1(200, 250-125*bcsign(otmp)), TRUE);
  531.         break;
  532.     case POT_GAIN_LEVEL:
  533.         if (otmp->cursed) {
  534.             unkn++;
  535.             /* they went up a level */
  536. #ifdef ENDGAME
  537.             if((dlevel > 1  || u.uhave_amulet) &&
  538.                             dlevel <= MAXLEVEL) { 
  539.                 You("rise up, through the ceiling!");
  540.                 goto_level((dlevel==1) ? ENDLEVEL
  541.                     : dlevel-1, FALSE, FALSE);
  542.             } else You("have an uneasy feeling.");
  543. #else
  544.             if(dlevel > 1 && dlevel <= MAXLEVEL) {
  545.                 You("rise up, through the ceiling!");
  546. #ifdef MACOS
  547.                 segments |= SEG_POTION;
  548. #endif
  549.                 goto_level(dlevel-1, FALSE, FALSE);
  550.             } else You("have an uneasy feeling.");
  551. #endif
  552.             break;
  553.         }
  554.         pluslvl();
  555.         if (otmp->blessed)
  556.             /* blessed potions place you at a random spot in the
  557.              * middle of the new level instead of the low point
  558.              */
  559.             u.uexp = rndexp();
  560.         break;
  561.     case POT_HEALING:
  562.         You("begin to feel better.");
  563.         healup(d(5,2) + 5 * bcsign(otmp),
  564.                1, !!(otmp->blessed), !(otmp->cursed));
  565.         break;
  566.     case POT_EXTRA_HEALING:
  567.         You("feel much better.");
  568.         healup(d(5,4) + 5 * bcsign(otmp),
  569.                2+3*!!(otmp->blessed), !(otmp->cursed), 1);
  570.         make_hallucinated(0L,TRUE);
  571.         break;
  572.     case POT_LEVITATION:
  573. #ifdef SPELLS
  574.     case SPE_LEVITATION:
  575. #endif
  576.         if(!Levitation) {
  577.             float_up();
  578.             if (otmp->cursed) {
  579. #ifdef STRONGHOLD
  580.     if((u.ux != xupstair || u.uy != yupstair) &&
  581.        (!xupladder || u.ux != xupladder || u.uy != yupladder)) {
  582. #else
  583.     if(u.ux != xupstair || u.uy != yupstair) {
  584. #endif /* STRONGHOLD /**/
  585.                     You("hit your %s on the ceiling.",
  586.                         body_part(HEAD));
  587.                     losehp(uarmh ? 1 : rnd(10),
  588.                         "colliding with the ceiling",
  589.                         KILLED_BY);
  590.                 } else (void) doup();
  591.             }
  592.         } else
  593.             nothing++;
  594.         if (otmp->blessed) {
  595.             char buf[BUFSZ];
  596.             int lmoves = 0;
  597.  
  598.             makeknown(POT_LEVITATION);
  599.             pline("How many moves do you wish to levitate for? [1-300] ");
  600.             do {
  601.                 getlin(buf);
  602.             } while (buf[0]=='\033' || !buf[0] ||
  603.                 (lmoves = atoi(buf)) < 1 || lmoves > 300);
  604.             HLevitation += lmoves;
  605.         } else HLevitation += rnd(150);
  606.         u.uprops[LEVITATION].p_tofn = float_down;
  607.         break;
  608. #ifdef SPELLS
  609.     case POT_GAIN_ENERGY:            /* M. Stephenson */
  610.         {    register int     num;
  611.             if(otmp->cursed)
  612.                 You("feel lackluster.");
  613.             else
  614.                 pline("Magical energies course through your body.");
  615.             num = rnd(5) + 5 * otmp->blessed + 1;
  616.             u.uenmax += (otmp->cursed) ? -num : num;
  617.             u.uen += (otmp->cursed) ? -num : num;
  618.             if(u.uenmax <= 0) u.uen = u.uenmax = 0;
  619.             flags.botl = 1;
  620.         }
  621.         break;
  622. #endif
  623.     default:
  624.         impossible("What a funny potion! (%u)", otmp->otyp);
  625.         return(0);
  626.     }
  627.     return(-1);
  628. }
  629.  
  630. void
  631. healup(nhp, nxtra, curesick, cureblind)
  632.     int    nhp, nxtra;
  633.     register boolean curesick, cureblind;
  634. {
  635. #ifdef POLYSELF
  636.     if (u.mtimedone && nhp) {
  637.         u.mh += nhp;
  638.         if (u.mh > u.mhmax) u.mh = (u.mhmax += nxtra);
  639.     }
  640. #endif
  641.     if(nhp)    {
  642.         u.uhp += nhp;
  643.         if(u.uhp > u.uhpmax)    u.uhp = (u.uhpmax += nxtra);
  644.     }
  645.     if(cureblind)    make_blinded(0L,TRUE);
  646.     if(curesick)    make_sick(0L,TRUE);
  647.     flags.botl = 1;
  648.     return;
  649. }
  650.  
  651. void
  652. strange_feeling(obj,txt)
  653. register struct obj *obj;
  654. register const char *txt;
  655. {
  656.     if(flags.beginner)
  657.         You("have a %s feeling for a moment, then it passes.",
  658.         Hallucination ? "normal" : "strange");
  659.     else
  660.         pline(txt);
  661.  
  662.     if(!obj)    /* e.g., crystal ball finds no traps */
  663.         return;
  664.  
  665.     if(obj->dknown && !objects[obj->otyp].oc_name_known &&
  666.                         !objects[obj->otyp].oc_uname)
  667.         docall(obj);
  668.     useup(obj);
  669. }
  670.  
  671. const char *bottlenames[] = {
  672.     "bottle", "phial", "flagon", "carafe", "flask", "jar", "vial"
  673. };
  674.  
  675. void
  676. potionhit(mon, obj)
  677. register struct monst *mon;
  678. register struct obj *obj;
  679. {
  680.     register const char *botlnam = bottlenames[rn2(SIZE(bottlenames))];
  681.     boolean uclose, isyou = (mon == &youmonst);
  682.  
  683.     if(isyou) {
  684.         uclose = TRUE;
  685.         pline("The %s crashes on your %s and breaks into shivers.",
  686.             botlnam, body_part(HEAD));
  687.         losehp(rnd(2), "thrown potion", KILLED_BY_AN);
  688.     } else {
  689.         uclose = (dist(mon->mx,mon->my) < 3);
  690.         if(Blind) pline("Crash!");
  691.         else pline("The %s crashes on %s%s and breaks into shivers.",
  692.             botlnam, mon_nam(mon), (haseyes(mon->data) &&
  693.             mon->data != &mons[PM_FLOATING_EYE]) ?
  694. #ifdef WORM
  695.             (notonhead ? "'s body" : "'s head")
  696. #else
  697.             "'s head"
  698. #endif
  699.             : "");
  700.         if(rn2(5) && mon->mhp > 1)
  701.             mon->mhp--;
  702.     }
  703. #ifdef WORM
  704.     notonhead = FALSE;
  705. #endif
  706.     pline("The %s evaporates.", xname(obj));
  707.  
  708.     if(!isyou) switch (obj->otyp) {
  709.  
  710.     case POT_RESTORE_ABILITY:
  711.     case POT_GAIN_ABILITY:
  712.     case POT_HEALING:
  713.     case POT_EXTRA_HEALING:
  714.         if(mon->mhp < mon->mhpmax) {
  715.             mon->mhp = mon->mhpmax;
  716.             if(!Blind)
  717.             pline("%s looks sound and hale again.", Monnam(mon));
  718.         }
  719.         break;
  720.     case POT_SICKNESS:
  721.         if((mon->mhpmax > 3) && !resist(mon, POTION_SYM, 0, NOTELL))
  722.             mon->mhpmax /= 2;
  723.         if((mon->mhp > 2) && !resist(mon, POTION_SYM, 0, NOTELL))
  724.             mon->mhp /= 2;
  725.         if(!Blind)
  726.         pline("%s looks rather ill.", Monnam(mon));
  727.         break;
  728.     case POT_CONFUSION:
  729.     case POT_BOOZE:
  730.         if(!resist(mon, POTION_SYM, 0, NOTELL))  mon->mconf = 1;
  731.         break;
  732.     case POT_INVISIBILITY:
  733.         unpmon(mon);
  734.         mon->minvis = 1;
  735.         pmon(mon);
  736.         break;
  737.     case POT_PARALYSIS:
  738.         if (mon->mcanmove) {
  739.             mon->mcanmove = 0;
  740.             /* really should be rnd(5) for consistency with players
  741.              * breathing potions, but...
  742.              */
  743.             mon->mfrozen = rnd(25);
  744.         }
  745.         break;
  746.     case POT_SPEED:
  747.         if (mon->mspeed == MSLOW) mon->mspeed = 0;
  748.         else mon->mspeed = MFAST;
  749.         break;
  750.     case POT_BLINDNESS:
  751.         {
  752.             register int btmp = 64 + rn2(32) +
  753.                     rn2(32) * !resist(mon, POTION_SYM, 0, NOTELL);
  754.             mon->mblinded |= btmp;
  755.             mon->mcansee = 0;
  756.         }
  757.         break;
  758.     case POT_WATER:
  759.         if (is_undead(mon->data) || is_demon(mon->data)) {
  760.             if (obj->blessed) {
  761.                 kludge("%s shrieks in pain!", Monnam(mon));
  762.                 mon->mhp -= d(2,6);
  763.                 if (mon->mhp <1) killed(mon);
  764.             } else if (obj->cursed) {
  765.                 if(!Blind)
  766.                 pline("%s looks healthier.", Monnam(mon));
  767.                 mon->mhp += d(2,6);
  768.                 if (mon->mhp > mon->mhpmax)
  769.                     mon->mhp = mon->mhpmax;
  770.             }
  771.         }
  772.         /* TO DO: Gremlins multiply when doused with water */
  773.         break;
  774. /*
  775.     case POT_GAIN_LEVEL:
  776.     case POT_LEVITATION:
  777.     case POT_FRUIT_JUICE:
  778.     case POT_MONSTER_DETECTION:
  779.     case POT_OBJECT_DETECTION:
  780.         break;
  781. */
  782.     }
  783.     if(uclose && rn2(5))
  784.         potionbreathe(obj);
  785.     obfree(obj, (struct obj *)0);
  786. }
  787.  
  788. void
  789. potionbreathe(obj)
  790. register struct obj *obj;
  791. {
  792.     register int i, ii, isdone;
  793.  
  794.     switch(obj->otyp) {
  795.     case POT_RESTORE_ABILITY:
  796.     case POT_GAIN_ABILITY:
  797.         if(obj->cursed) {
  798.             pline("Ulch!  That potion smells terrible!");
  799.             break;
  800.         } else {
  801.             i = rn2(A_MAX);        /* start at a random point */
  802.             for(isdone = ii = 0; !isdone && ii < A_MAX; ii++) {
  803.             if(ABASE(i) < AMAX(i)) {
  804.                 ABASE(i)++;
  805.                 /* only first found if not blessed */
  806.                 isdone = !(obj->blessed);
  807.                 flags.botl = 1;
  808.             }
  809.             if(++i >= A_MAX) i = 0;
  810.             }
  811.         }
  812.         break;
  813.     case POT_HEALING:
  814.     case POT_EXTRA_HEALING:
  815.         if(u.uhp < u.uhpmax) u.uhp++, flags.botl = 1;
  816.         break;
  817.     case POT_SICKNESS:
  818.         if(u.uhp <= 5) u.uhp = 1; else u.uhp -= 5;
  819.         flags.botl = 1;
  820.         break;
  821.     case POT_HALLUCINATION:
  822.         You("have a vision for a moment.");
  823.         break;
  824.     case POT_CONFUSION:
  825.     case POT_BOOZE:
  826.         if(!Confusion)
  827.             You("feel somewhat dizzy.");
  828.         make_confused(HConfusion + rnd(5),FALSE);
  829.         break;
  830.     case POT_INVISIBILITY:
  831.         if (!See_invisible && !Invis)
  832.             pline("For an instant you could see through yourself!");
  833.         break;
  834.     case POT_PARALYSIS:
  835.         pline("Something seems to be holding you.");
  836.         nomul(-rnd(5));
  837.         break;
  838.     case POT_SPEED:
  839.         Fast += rnd(5);
  840.         Your("knees seem more flexible now.");
  841.         break;
  842.     case POT_BLINDNESS:
  843.         if(!Blind) pline("It suddenly gets dark.");
  844.         make_blinded(Blinded + rnd(5),FALSE);
  845.         seeoff(0);
  846.         break;
  847. /*
  848.     case POT_GAIN_LEVEL:
  849.     case POT_LEVITATION:
  850.     case POT_FRUIT_JUICE:
  851.     case POT_MONSTER_DETECTION:
  852.     case POT_OBJECT_DETECTION:
  853.         break;
  854. */
  855.     }
  856.     /* note: no obfree() */
  857. }
  858.  
  859. static boolean
  860. neutralizes(o1, o2)
  861. register struct obj *o1, *o2;
  862. {
  863.     switch (o1->otyp) {
  864.         case POT_SICKNESS:
  865.         case POT_HALLUCINATION:
  866.         case POT_BLINDNESS:
  867.         case POT_CONFUSION:
  868.             if (o2->otyp == POT_HEALING ||
  869.                 o2->otyp == POT_EXTRA_HEALING)
  870.                 return TRUE;
  871.         case POT_HEALING:
  872.         case POT_EXTRA_HEALING:
  873.         case UNICORN_HORN:
  874.             if (o2->otyp == POT_SICKNESS ||
  875.                 o2->otyp == POT_HALLUCINATION ||
  876.                 o2->otyp == POT_BLINDNESS ||
  877.                 o2->otyp == POT_CONFUSION)
  878.                 return TRUE;
  879.     }
  880.  
  881.     return FALSE;
  882. }
  883.  
  884. boolean
  885. get_wet(obj)
  886. register struct obj *obj;
  887. /* returns TRUE if something happened (potion should be used up) */
  888. {
  889.     switch (obj->olet) {
  890.         case WEAPON_SYM:
  891.         if (!obj->rustfree &&
  892.             objects[obj->otyp].oc_material == METAL &&
  893.             obj->spe > -6 && !rn2(10)) {
  894.             Your("%s somewhat.", aobjnam(obj,"rust"));
  895.             obj->spe--;
  896.             return TRUE;
  897.         } else break;
  898.         case POTION_SYM:
  899.         if (obj->otyp == POT_WATER) return FALSE;
  900.         Your("%s.", aobjnam(obj,"dilute"));
  901.         if (obj->spe == -1) {
  902.             obj->spe = 0;
  903.             obj->blessed = obj->cursed = 0;
  904.             obj->otyp = POT_WATER;
  905.         } else obj->spe--;
  906.         return TRUE;
  907.         case SCROLL_SYM:
  908.         if (obj->otyp != SCR_BLANK_PAPER
  909. #ifdef MAIL
  910.             && obj->otyp != SCR_MAIL
  911. #endif
  912.             ) {
  913.             if (!Blind) {
  914.                 if (obj->quan == 1)
  915.                     pline("The scroll fades.");
  916.                 else pline("The scrolls fade.");
  917.             }
  918.             obj->otyp = SCR_BLANK_PAPER;
  919.             return TRUE;
  920.         }
  921.     }
  922.     Your("%s wet.", aobjnam(obj,"get"));
  923.     return FALSE;
  924. }
  925.  
  926. int
  927. dodip()
  928. {
  929.     register struct obj *potion, *obj;
  930.     const char *tmp;
  931.     uchar here;
  932.  
  933.     if(!(obj = getobj("#", "dip")))
  934.         return(0);
  935.  
  936.     here = levl[u.ux][u.uy].typ;
  937. #ifdef FOUNTAINS
  938.     /* Is there a fountain to dip into here? */
  939.     if (IS_FOUNTAIN(here)) {
  940.         pline("Dip it into the fountain? ");
  941.         if(yn() == 'y') {
  942.             dipfountain(obj);
  943.             return(1);
  944.         }
  945.     }
  946. #endif
  947.         if (is_pool(u.ux,u.uy)) {
  948.         pline("Dip it into the %s? ",
  949.               here == POOL ? "pool" : "moat");
  950.         if(yn() == 'y') {
  951.             (void) get_wet(obj);
  952.             return(1);
  953.         }
  954.     }
  955.  
  956.     if(!(potion = getobj(beverages, "dip into")))
  957.         return(0);
  958.     if (potion==obj && potion->quan==1) {
  959.         pline("That is a potion bottle, not a Klein bottle!");
  960.         return 0;
  961.     }
  962.     if(potion->otyp == POT_WATER) {
  963.         if (potion->blessed) {
  964.             if (obj->cursed) {
  965.                 if (!Blind)
  966.                     Your("%s %s.",
  967.                       aobjnam(obj, "softly glow"),
  968.                       Hallucination ? hcolor() : amber);
  969.                 obj->cursed=0;
  970.                 obj->bknown=1;
  971.     poof:
  972.                 if(!(objects[potion->otyp].oc_name_known) &&
  973.                    !(objects[potion->otyp].oc_uname))
  974.                     docall(potion);
  975.                 useup(potion);
  976.                 return(1);
  977.             } else if(!obj->blessed) {
  978.                 if (!Blind) {
  979.                     tmp = Hallucination ? hcolor() : light_blue;
  980.                     Your("%s with a%s %s aura.",
  981.                       aobjnam(obj, "softly glow"),
  982.                       index(vowels, *tmp) ? "n" : "", tmp);
  983.                 }
  984.                 obj->blessed=1;
  985.                 obj->bknown=1;
  986.                 goto poof;
  987.             }
  988.         } else if (potion->cursed) {
  989.             if (obj->blessed) {
  990.                 if (!Blind)
  991.                     Your("%s %s.", aobjnam(obj, "glow"),
  992.                      Hallucination ? hcolor() : (const char *)"brown");
  993.                 obj->blessed=0;
  994.                 obj->bknown=1;
  995.                 goto poof;
  996.             } else if(!obj->cursed) {
  997.                 if (!Blind) {
  998.                     tmp = Hallucination ? hcolor() : black;
  999.                     Your("%s with a%s %s aura.",
  1000.                       aobjnam(obj, "glow"),
  1001.                       index(vowels, *tmp) ? "n" : "", tmp);
  1002.                 }
  1003.                 obj->cursed=1;
  1004.                 obj->bknown=1;
  1005.                 goto poof;
  1006.             }
  1007.         } else
  1008.             if (get_wet(obj))
  1009.                 goto poof;
  1010.     }
  1011.     else if(obj->olet == POTION_SYM && obj->otyp != potion->otyp) {
  1012.         /* Mixing potions is dangerous... */
  1013.         pline("The potions mix...");
  1014.         if (obj->cursed || !rn2(10)) {
  1015.             pline("BOOM!  They explode!");
  1016.             u.uhp -= rnd(10);
  1017.             flags.botl = 1;
  1018.             potionbreathe(obj);
  1019.             useup(obj);
  1020.             useup(potion);
  1021.             return(1);
  1022.         }
  1023.  
  1024.         obj->blessed = obj->cursed = obj->bknown = 0;
  1025.         if (Blind) obj->dknown = 0;
  1026.  
  1027.         switch (neutralizes(obj, potion) ||
  1028.             obj->spe == -1 /* diluted */ ? 1 : rnd(8)) {
  1029.             case 1:
  1030.                 obj->otyp = POT_WATER;
  1031.                 obj->blessed = obj->cursed = 0;
  1032.                 break;
  1033.             case 2:
  1034.             case 3:
  1035.                 obj->otyp = POT_SICKNESS;
  1036.                 break;
  1037.             case 4:
  1038.                 {
  1039.                   struct obj *otmp;
  1040.                   otmp = mkobj(POTION_SYM,FALSE);
  1041.                   obj->otyp = otmp->otyp;
  1042.                   obfree(otmp, (struct obj *)0);
  1043.                 }
  1044.                 break;
  1045.             default:
  1046.                 if (!Blind)
  1047.                 pline("The mixture glows brightly and evaporates.");
  1048.                 useup(obj);
  1049.                 useup(potion);
  1050.                 return(1);
  1051.         }
  1052.  
  1053.         if (obj->otyp == POT_WATER) {
  1054.             obj->spe = 0; /* in case it was diluted before */
  1055.             pline("The mixture bubbles violently%s.",
  1056.                 Blind ? "" : ", then clears");
  1057.         } else {
  1058.             obj->spe--; /* diluted */
  1059.             if (!Blind) {
  1060.                 pline("The mixture looks %s.", objects[obj->otyp].oc_descr);
  1061.                 obj->dknown = 1;
  1062.             }
  1063.         }
  1064.  
  1065.         useup(potion);
  1066.         return(1);
  1067.     }
  1068.  
  1069.     if(obj->olet == WEAPON_SYM && obj->otyp <= SHURIKEN) {
  1070.         if(potion->otyp == POT_SICKNESS && !obj->opoisoned) {
  1071.         char buf[BUFSZ];
  1072.         Strcpy(buf, xname(potion));
  1073.         pline("The %s form%s a coating on the %s.",
  1074.             buf, potion->quan==1 ? "s" : "", xname(obj));
  1075.         obj->opoisoned = 1;
  1076.         goto poof;
  1077.         } else if(obj->opoisoned && 
  1078.               (potion->otyp == POT_HEALING ||
  1079.                potion->otyp == POT_EXTRA_HEALING)) {
  1080.         pline("A coating wears off the %s.", xname(obj));
  1081.         obj->opoisoned = 0;
  1082.         goto poof;
  1083.         }
  1084.     }
  1085.  
  1086.     if(obj->otyp == UNICORN_HORN && neutralizes(obj, potion)) {
  1087.         pline("The potion clears.");
  1088.         potion->otyp = POT_WATER;
  1089.         potion->blessed = 0;
  1090.         potion->cursed = 0;
  1091.         potion->spe = 0;
  1092.         return(1);
  1093.     }
  1094.  
  1095.     pline("Interesting...");
  1096.     return(1);
  1097. }
  1098.  
  1099.  
  1100. void
  1101. djinni_from_bottle(obj)
  1102. register struct obj *obj;
  1103. {
  1104.     register struct monst *mtmp;
  1105.  
  1106.     if(!(mtmp = makemon(&mons[PM_DJINNI], u.ux, u.uy))){
  1107.         pline("It turns out to be empty.");
  1108.         return;
  1109.     }
  1110.  
  1111.     if (!Blind) {
  1112.         pline("In a cloud of smoke, %s emerges!", defmonnam(mtmp));
  1113.         pline("%s speaks.", Monnam(mtmp));
  1114.     } else {
  1115.         You("smell acrid fumes.");
  1116.         pline("Something speaks.");
  1117.     }
  1118.  
  1119.     switch (obj->blessed ? 0 : obj->cursed ? 4 : rn2(5)) {
  1120.     case 0 : verbalize("I am in your debt.  I will grant one wish!");
  1121.         makewish();
  1122.         mongone(mtmp);
  1123.         break;
  1124.     case 1 : verbalize("Thank you for freeing me!");
  1125.         (void) tamedog(mtmp, (struct obj *)0);
  1126.         break;
  1127.     case 2 : verbalize("You freed me!");
  1128.         mtmp->mpeaceful = 1;
  1129.         break;
  1130.     case 3 : verbalize("It is about time!");
  1131.         pline("The %s vanishes.",
  1132.             Hallucination ? rndmonnam() : "djinni");
  1133.         mongone(mtmp);
  1134.         break;
  1135.     default: verbalize("You disturbed me, fool!");
  1136.         break;
  1137.     }
  1138. }
  1139.  
  1140. /* monster_detect is also used in the crystal ball routine */
  1141. /* returns 1 if nothing was detected        */
  1142. /* returns 0 if something was detected        */
  1143. int
  1144. monster_detect(otmp)
  1145. register struct obj    *otmp;
  1146. {
  1147.     register struct monst    *mtmp;
  1148.  
  1149.     if(!fmon) {
  1150.         if (otmp)
  1151.             strange_feeling(otmp, Hallucination ?
  1152.                           "You get the heebie jeebies." :
  1153.                           "You feel threatened.");
  1154.         return(1);
  1155.     } else {
  1156.         int woken = FALSE;
  1157.  
  1158.         cls();
  1159.         for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
  1160.             if(mtmp->mx > 0)
  1161.             at(mtmp->mx, mtmp->my,
  1162.                (uchar)(Hallucination ? rndmonsym() : mtmp->data->mlet),
  1163.                AT_MON);
  1164.             if (otmp && otmp->cursed && (mtmp->msleep || !mtmp->mcanmove)) {
  1165.                 mtmp->msleep = mtmp->mfrozen = 0;
  1166.                 mtmp->mcanmove = 1;
  1167.                 woken = TRUE;
  1168.             }
  1169.         }
  1170.         prme();
  1171.         You("sense the presence of monsters.");
  1172.         if (woken)
  1173.             pline("Monsters sense the presence of you.");
  1174.         more();
  1175.         docrt();
  1176.     }
  1177.     return(0);
  1178. }
  1179.  
  1180. #endif /* OVLB */
  1181. #ifdef OVL0
  1182.  
  1183. /* object_detect is also used in the crystal ball routine */
  1184. /* returns 1 if nothing was detected        */
  1185. /* returns 0 if something was detected        */
  1186. int
  1187. object_detect(otmp)
  1188. register struct obj    *otmp;
  1189. {
  1190.     register struct obj    *objs;
  1191.     register struct monst    *mtmp;
  1192.     boolean mfound=FALSE, mofound=FALSE;
  1193.  
  1194.     if(!fobj) {
  1195.         for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
  1196.             /* mofound can be 1 of 2 completely different things,
  1197.              * either of which stops the "strange feeling"...
  1198.              */
  1199.             if (mtmp->minvent || (mtmp->mimic && otmp->cursed)) {
  1200.                 mofound = TRUE;
  1201.                 break;
  1202.             }
  1203.         }
  1204.         if (!mofound) {
  1205.             if (otmp)
  1206.                 strange_feeling(otmp, "You feel a pull downward.");
  1207.             return(1);
  1208.         }
  1209.     }
  1210.     if (mofound) goto outobjmap;
  1211.     for(objs = fobj; objs; objs = objs->nobj)
  1212.         if(objs->ox != u.ux || objs->oy != u.uy)
  1213.             goto outobjmap;
  1214.     You("sense the presence of objects nearby.");
  1215.     return(0);
  1216. outobjmap:
  1217.     cls();
  1218.     for(objs = fobj; objs; objs = objs->nobj)
  1219. at(objs->ox, objs->oy, (uchar)(Hallucination ? rndobjsym() : objs->olet), AT_OBJ);
  1220.     /* monster possessions added by GAN 12/16/86 */
  1221.     for(mtmp = fmon ; mtmp ; mtmp = mtmp->nmon)
  1222.         if(mtmp->minvent)
  1223.             for(objs = mtmp->minvent;objs;objs = objs->nobj)
  1224.                 at(mtmp->mx, mtmp->my, (uchar)objs->olet, AT_OBJ);
  1225.     if (otmp && otmp->cursed) {
  1226.         for(mtmp = fmon; mtmp; mtmp = mtmp->nmon) {
  1227.             if (mtmp->mimic) {
  1228.                 mnexto(mtmp);
  1229.                 mfound = TRUE;
  1230.             }
  1231.         }
  1232.     }
  1233.     prme();
  1234.     You("sense the presence of objects.");
  1235.     if (mfound) pline("Objects sense the presence of you.");
  1236.     more();
  1237.     docrt();
  1238.     return(0);
  1239. }
  1240.  
  1241. #endif /* OVL0 */
  1242. #ifdef OVLB
  1243.  
  1244. /* the detections are pulled out so they can    */
  1245. /* also be used in the crystal ball routine    */
  1246. /* returns 1 if nothing was detected        */
  1247. /* returns 0 if something was detected        */
  1248. int
  1249. trap_detect(sobj)
  1250. register struct obj    *sobj;
  1251. /* sobj is null if crystal ball, *scroll if gold detection scroll */
  1252. {
  1253.     register struct trap *ttmp;
  1254.     register struct obj *obj;
  1255.     register int door;
  1256.     boolean found = FALSE;
  1257.     coord cc;
  1258.  
  1259.     for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap) {
  1260.         if(ttmp->tx != u.ux || ttmp->ty != u.uy)
  1261.             goto outtrapmap;
  1262.         else found = TRUE;
  1263.     }
  1264.     for(obj = fobj; obj; obj = obj->nobj) {
  1265.         if ((obj->otyp==LARGE_BOX || obj->otyp==CHEST) && obj->otrapped)
  1266.             if (obj->ox != u.ux || obj->oy != u.uy)
  1267.                 goto outtrapmap;
  1268.             else found = TRUE;
  1269.     }
  1270.     for(door=0; door<=doorindex; door++) {
  1271.         cc = doors[door];
  1272.         if (levl[cc.x][cc.y].doormask & D_TRAPPED)
  1273.             if (cc.x != u.ux || cc.x != u.uy)
  1274.                 goto outtrapmap;
  1275.             else found = TRUE;
  1276.     }
  1277.     if(!found) {
  1278.         char buf[42];
  1279.         Sprintf(buf, "Your %s stop itching.",
  1280.             makeplural(body_part(TOE)));
  1281.         strange_feeling(sobj,buf);
  1282.         return(1);
  1283.     }
  1284.     /* traps exist, but only under me - no separate display required */
  1285.     Your("%s itch.", makeplural(body_part(TOE)));
  1286.     return(0);
  1287. outtrapmap:
  1288.     cls();
  1289. #define SYMBOL (uchar)(Hallucination ? rndobjsym() : \
  1290.         (sobj && sobj->cursed) ? GOLD_SYM : TRAP_SYM)
  1291. #define AT Hallucination || (sobj && sobj->cursed) ? AT_OBJ : AT_MAP
  1292.     for(ttmp = ftrap; ttmp; ttmp = ttmp->ntrap)
  1293.         at(ttmp->tx, ttmp->ty, SYMBOL, AT);
  1294.     for(obj = fobj; obj; obj = obj->nobj) {
  1295.         if ((obj->otyp==LARGE_BOX || obj->otyp==CHEST) && obj->otrapped)
  1296.             at(obj->ox, obj->oy, SYMBOL, AT);
  1297.     }
  1298.     for(door=0; door<=doorindex; door++) {
  1299.         cc = doors[door];
  1300.         if (levl[cc.x][cc.y].doormask & D_TRAPPED)
  1301.             at(cc.x, cc.y, SYMBOL, AT);
  1302.     }
  1303. #undef SYMBOL
  1304. #undef AT
  1305.     prme();
  1306.     if (sobj && sobj->cursed)
  1307.         You("feel very greedy.");
  1308.     else
  1309.         You("feel entrapped.");
  1310.     more();
  1311.     docrt();
  1312.     return(0);
  1313. }
  1314.  
  1315. #endif /* OVLB */
  1316.